﻿using System.Text;
using System.Windows.Forms;
using E4RPTools;

namespace DBTractores
{
    public partial class ErrorForm : Form
    {
        #region Members

        private ErrorList _errors;

        #endregion

        #region Properties

        public ErrorList Errors
        {
            set
            {
                _errors = value;
                gridControl.DataSource = value;
            }
        }

        #endregion

        public ErrorForm()
        {
            InitializeComponent();
        }

        private void copyButton_Click(object sender, System.EventArgs e)
        {
            var errorsText = new StringBuilder();
            foreach (var error in _errors)
                errorsText.AppendLine(error.Reference + "\t" + error.Message);
            if (errorsText.Length > 0)
                Clipboard.SetText(errorsText.ToString());
        }
    }
}